function main() {
    debugger
    const self = this;

    let formPartEle = self.$$("form_part_6yhn7q");
    let formRenderEle = formPartEle.$$getRenderElement();

    formRenderEle.$$validateData().then(vRes => {
        if (!(vRes && vRes.success)) {
            return;
        }
        let abortReason = self.$$("textarea_b5nd3r").cValue;

        let recIdList = self.state.extraParams.recId;

        if (recIdList && typeof recIdList === 'object' && !Array.isArray(recIdList)) {
            recIdList = Object.values(recIdList);
        }

        if (!Array.isArray(recIdList)) {
            recIdList = recIdList ? [recIdList] : [];
        }
        deleteRec(recIdList, abortReason).then(r => {
            coseMjing();
        })
    });

}


function deleteRec(recIdList, abortReason) {
    const jsonParams = {
        recIdList: recIdList,
        opinion: abortReason
    };
    return new Promise((resolve, reject) => {
        api.DATA_SOURCE_EXECUTE("ds_api:afa1909f-ffce-4730-9f94-27b0a79e62f7", "api", [], [], JSON.stringify(jsonParams)).then((res) => {
            let isSuccess = JSON.parse(res.result).success;
            if (isSuccess) {
                resolve(isSuccess);
            } else {
                reject(isSuccess);
            }
        })
    });
}


function coseMjing() {
    console.log(this);
    if (window.parent) {
        window.parent.postMessage(JSON.stringify({
            event: "close-dialog",
            param: {"XXX": "test"}
        }), "*");
    }
}

